export default function getToday(format = 'YYYY-MM-DD') {
	const today = new Date();
	const year = today.getFullYear();
	let month = today.getMonth() + 1;
	let day = today.getDate();

	month = month < 10 ? '0' + month : month;
	day = day < 10 ? '0' + day : day;

	if (format === 'YYYY-MM-DD') {
		return `${year}-${month}-${day}`;
	} else if (format === 'DD/MM/YYYY') {
		return `${day}/${month}/${year}`;
	} else if (format === 'MM/DD/YYYY') {
		return `${month}/${day}/${year}`;
	} else {
		throw new Error('Unsupported date format');
	}
}

// // 调用函数
// console.log(getFormattedDate('YYYY-MM-DD')); // 输出：2025-04-08
// console.log(getFormattedDate('DD/MM/YYYY')); // 输出：08/04/2025
// console.log(getFormattedDate('MM/DD/YYYY')); // 输出：04/08/2025